home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software 2000
/
Software 2000 Volume 1 (Disc 1 of 2).iso
/
utilities
/
u568.dms
/
u568.adf
/
XIcon
/
CLICK_ME
< prev
next >
Wrap
Text File
|
1986-05-23
|
10KB
|
229 lines
9 August 1986
XICON -- Execute Command File from an Icon
TICON -- Type Text File from an Icon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) 1986 by Pete Goodeve -- All Rights Reserved
Permission is granted to distribute or modify these programs freely,
provided that no charge is made for their use, and that this notice
accompanies them. For any commercial purposes, please contact the
author:
Pete Goodeve
3012 Deakin Street #D
Berkeley, Calif. 94705
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*********
XICON
*********
With this program you can execute a file of AmigaDOS CLI commands
directly from a WorkBench window, rather than from the CLI, simply by
double-clicking an associated icon in the window. A full-screen window
will be opened to display the output of the commands. To close the
window again type a control-C (or control-D) -- or it can be configured to
close automatically by setting the ToolType 'MODE=closewindow' in the
icon.
You also have the option of executing commands from the ToolTypes lines
of the icon itself, if you specify them with the 'CMD=...' ToolType.
(There are advantages and disadvantages to this.)
The icon you click on must always have a file associated with it in order
to keep WorkBench happy, but this needn't NECESSARILY be a list of CLI
commands; if you set 'MODE=noscript' it can be any type of data; you can
operate on it if you want with commands in the ToolTypes list.
You can select more than one icon at a time if you like, by holding down
the Shift key as you click on each. Only DOUBLE-click on the LAST selection
(or use the "Open" item in the WorkBench Menu -- see "Introduction to
Amiga").
Setup: You can install Xicon itself in any convenient directory: the
best is probably either the 'C:' directory of your Workbench disk
or its root directory ('SYS:'). (It doesn't need an icon of its own.)
Whichever directory you use, the icons that are going to invoke it must
have a matching pathname as their DEFAULT TOOL (see below).
You can put an icon and its associated file in any directory ("drawer")
that you can open under WorkBench. The file must of course have the same
name as the icon (without the '.info' extension the icon has tacked on).
Each icon must be of type 'PROJECT' with a DEFAULT TOOL string specifying
a path to the Xicon program. If it is in the same directory, 'xicon' will
suffice, otherwise you must use the complete pathname.
Command Scripts: There are many ways to generate Command Script files
with their icons. One simple approach is to duplicate
the "democommand" supplied and rename it (using WorkBench Menu operations),
then go to the CLI and modify the text file using whatever editor you are
comfortable with. If xicon is not in the local directory, you will also
have to change the Default Tool in the icon to the correct pathname.
Alternatively you can create the text file first (let's call it 'myscript'),
then use the CLI to copy a suitable project icon ('democommand.info' for
instance) to 'myscript.info' and modify it as necessary.
Modifying an icon: All the changes you should need to make to an icon
can be done with the 'Info' item in the WorkBench
Menu. Select the icon you want to modify by clicking on it, depress the
right mouse button to bring up the menu, and select 'Info' from the
'WorkBench' section. This should bring up an information window for
that icon.
To set the DEFAULT TOOL, click in that gadget and type in (or edit) the
string.
To enter a new TOOL TYPE, click first on the ADD gadget, then click in the
string gadget and type it in. If you want to insert it into an existing
set, use the arrow gadgets on the left to move to the desired point first.
You can of course edit the strings in the usual way. Use the DEL gadget
to remove a line completely.
When you are done, click in the SAVE box to preserve the changes.
MODE Setting: You can alter the assumptions made by Xicon by setting the
Tool Type 'MODE'.
'MODE=closewindow' avoids having to type control-C to terminate
the program. The window will close as soon as all the commands
have completed.
'MODE=noscript' prevents Xicon from trying to read commands from
its associated file, so this can be of any type. This option only
makes sense if the 'CMD=' Tool Type is used to supply the commands.
Only one MODE entry will be recognized in the Tool Types array, so if you
want both the above options, specify 'MODE=noscript|closewindow'.
Commands in the Icon: Instead of a script file, you can specify commands
directly in the Tool Types array of the icon, with
the 'CMD=command string' format. (For example: 'CMD=list df1:work'.)
Include as many of these as you like. They will be executed in sequence,
but each by a separate CLI process, so you can't use a command to set
parameters like stack size or current directory for the ones that follow.
A Command Script file on the other hand is executed completely by one
process, so settings are inherited.
Caveats:
There is no provision at the moment for changing the size of the display
window -- it is always full-screen. A later version may allow you to
specify this via the TOOLTYPES strings in the icon.
The most annoying defect is that the "Execute()" system call used by
xicon loses track of the current directory when invoked by a WorkBench
program (it switches to DF0:). I've tried a lot of tricks to correct
this, without success, so -- if you want to list the directory or
something -- I'm afraid you always have to specify a FULL pathname
somewhere in the command script. Sorry. If you have several commands
in your script, make a suitable 'CD mydisk:mydir' your first command.
The "Execute" referred to above is NOT the DOS "EXECUTE" Command, by the
way, in case anyone is confused. Actually it requires the DOS "RUN"
command -- which must be available in the "C:" directory -- for its
operation. (Now I'll bet you're confused again...)
Because xicon's method of calling Execute() sets up the command
file as the input stream, the output window cannot be used as a
console. So if a command needs keyboard input it must open up its own
console window using I/O redirection, e.g.:
mycommand <CON:0/100/150/50/input
(It would likely be a program of your own, because DOS commands don't
usually ask for input, unless you use the "?" option in the command
line. Although, for an example, see the "Set Date" command file in this
directory.) You might also want to try "EXECUTE CON:0/100/150/50/exec"
--or whatever you have renamed that command as. (To get out of the
mini-CLI you just created, use 'control-\'.)
The initial stack size is always 4000 bytes. You can change this in
your command script with a sutitable STACK command. Note that the
STACK gadget in the icon Info window does not have any effect. (Except
on the stack used by Xicon itself! I haven't investigated how much
it needs.)
You cannot interrupt a command sequence with control-C or control-D
(because the input stream has been diverted), although output can be
paused with the space bar in the usual way. Be careful not to write
a command file that can get "stuck", or you will never be able to
close that window.
Unfortunately DOS won't let you use IF, SKIP, QUIT, and so on in
these command files, and of course argument expansion is not available.
I really SHOULD have supplied some kind of close gadget for the window,
rather than requiring the user to type control-C, but locating a
window opened as a DOS Console is a pain, so maybe another time...
%%%%%%%%%%%%%%%%
*********
TICON
*********
This program allows the user to display a text file by double-clicking
on an associated icon. You are probably reading this file under its
management. The pause at the end of each screenful is automatic.
Setup: Essentially identical to the procedures for Xicon above, except
that the file is displayed rather than executed, and the
DEFAULT TOOL is "TICON". Any simple text file may be used, provided it is
sensibly formatted (with newlines in the right places).
Restrictions: This is just a crude and simple text reading program. You
can't backtrack or skip forward. You can, however, abort
at any point with control-C. (If it is waiting for a return, you will have
to type this after the control-C. The window won't close until you type a
second control-C.)
There are no Tool Type options.
%%%%%%%%%%%%%%%%
Coda
I hope you find these programs useful. If you do, please pass them around
freely. I suggest you copy the entire drawer -- with its demo and source
files -- by dragging its icon to another disk. (You won't see either the
programs or their sources in the WorkBench window; they don't have icons.
You can only get at them using the CLI.)
I'll welcome any feedback you wish to give. My address is at the top.
Watch for some Shareware following not too far behind in this same pipe...
Over the last few months I have been developing an enhanced CLI system.
Unlike Xicon -- and all the other similar developments that I know of --
it does NOT use the Execute() call; instead, it handles all its own
facilities and provides total upward compatibility with the standard CLI.
Even at its present stage it is installed as my standard user interface.
(I'll leave you in suspense as to the extra features it will have for now.
When it is released you can check them out for yourself...)
##############